package com.leen.admin.entity;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.*;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 
 * 岗位
 */
@Getter
@Setter
@Table(name="job")
@Entity
@ToString(callSuper = true)
public class Job   implements Serializable {
    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    /**
     * 岗位名称
     */
    @NotBlank(message = "岗位名称不能为空")
    @Column(name = "name")
    private String name;

    /**
     * 岗位状态
     */
    @NotNull(message = "岗位状态不能为空")
    @Column(name = "enabled")
    private Long enabled;

    /**
     * 岗位排序
     */
    @NotNull(message = "岗位排序不能为空")
    @Column(name = "sort")
    private Long sort;

    /**
     * 部门ID
     */
    @NotNull(message = "部门编号不能为空")
    @Column(name = "dept_id")
    private Long deptId;

    /**
     * 创建日期
     */
    @DateTimeFormat(pattern = "yyyy/MM/dd HH:mm")
    @JSONField(format = "yyyy/MM/dd HH:mm")
    @Column(name = "create_time")
    private Date createTime;


    @DateTimeFormat(pattern = "yyyy/MM/dd HH:mm")
    @JSONField(format = "yyyy/MM/dd HH:mm")
    @Column(name = "update_time")
    private Date updateTime;



    @Column(name = "is_del")
    private Byte del;


    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "dept_id",referencedColumnName = "id")
    private static final long serialVersionUID = 1L;
}